int
posibleElim(tipoJuego * juego, int *elim, int linea, int cantColores)
{
	tipoTablero * tablero;
	int i, j, c;
	int limitei, limitej;
	
	if(juego->turno==JUGADOR_1)
		tablero=juego.tablero1;
	else
		tablero=juego.tablero2;
	limitei= tablero->fils-linea+1;
	limitej= tablero->cols-linea+1;


	for(c=1; c <= cantColores; c++)
	{	
	  	for(i=0; i < (tablero->fils); i++)
			for(j=0; j< limitej; j++)
				if((tablero->matriz[i][j] == c) || (tablero->matriz[i][j] == -1))
					elimHor(tablero, i, &j, elim, linea, c);
					
		for(i=0; i <= limitei; i++)
			for(j=0; j< (tablero->cols); j++)
				if((tablero->matriz[i][j] == c) || (tablero->matriz[i][j] == -1))
					elimVer(tablero, i, j, elim, linea, c);			

		for(i=0; i <= limitei; i++)
			for(j=0; j<= limitej; j++)

				if((tablero->matriz[i][j] == c) || (tablero->matriz[i][j] == -1))
					elimDiag(tablero, i, j, elim, linea, c, IZQ);
					elimDiag(tablero, i, j, elim, linea, c, DER);
		
					
	ceros(tablero);
	
	}
	
	
	return 0;
}
int
elimHor(tipoTablero * tablero, int i, int *j, int * elim, int linea, int color)
{	int cantH;
	int auxj=*j;

	cantH=cuentaHor(tablero, color,  i, auxj);

	if(cantH >= linea)
	{	while(cantH--)
		{	if(tablero->matriz[i][auxj]==color)
			{	(*elim)++;

				tablero->matriz[i][auxj]=-1;
			}
			auxj++;
		}
		*j=auxj;
	}
	return 0;
}
int
elimVer(tipoTablero * tablero, int i, int j, int * elim, int linea, int color)
{	int cantV;
	int auxi=i;
	
	
	cantV=cuentaVer(tablero, color,  auxi, j);

	if(cantV >= linea)
	{	while(cantV--)
		{	if(tablero->matriz[auxi][j]== color)
			{	(*elim)++;

				tablero->matriz[auxi][j]=-1;
			}
			auxi++;
		}
		i=auxi;
	}
	return 0;
}
int
elimDiag(tipoTablero * tablero, int i, int j, int * elim, int linea, int color, int orient)
{	int cantD;
	int auxi=i;
	int auxj=j;

	cantD=cuentaDiag(tablero, color,  auxi, auxj, orient);

	if(cantD >= linea)
	{	while(cantD--)
		{	if(tablero->matriz[auxi][auxj]== color)	
			{	(*elim)++;
				tablero->matriz[auxi][auxj]=-1;
			}
			auxi++;
			auxj= ((orient==IZQ)? auxj-1 : auxj+1);
		}
		j=auxj;
		i=auxi;
	}
	return 0;
}
int
cuentaHor(tipoTablero * tablero, int color, int i, int j)
{	 
	if( (tablero->matriz[i][j]==color) || (tablero->matriz[i][j]== -1))
		if(j+1 < tablero->cols)
			return 1+ cuentaHor(tablero, color, i, j+1);
		else
			return 1;
	return 0;
}
int
cuentaVer(tipoTablero * tablero, int color, int i, int j)
{
	if( (tablero->matriz[i][j]==color) || (tablero->matriz[i][j]== -1) ) 
		if(i+1 < tablero->fils)
			return 1+ cuentaVer(tablero, color, i+1, j);
		else
			return 1;
	return 0;
}	
int
cuentaDiag(tipoTablero * tablero, int color, int i, int j, int orient)
{
	if( (tablero->matriz[i][j]==color) || (tablero->matriz[i][j]== -1)) 
	{	j= ((orient==IZQ)? j-1 : j+1);
		if((i+1 < tablero->fils) && (j < tablero->cols) && (j >= 0))
			return 1+ cuentaDiag(tablero, color, i+1, j, orient);
		else
			return 1;
	}
	return 0;
}
int
ceros(tipoTablero * tablero)
{	int i, j;
  
	  for(i=0; i < tablero->fils; i++)
		for(j=0; j < tablero->cols; j++)
			if(tablero->matriz[i][j]==-1)
			
			  tablero->matriz[i][j]=0;
	  return 0;
}